/*
 * Copyright (c) 2011 CCXE(China) Co.,Ltd. All Rights Reserved.
 *
 * This software is the confidential and proprietary information of
 * CCXE(China) Co.,Ltd. ("Confidential Information").
 * It may not be copied or reproduced in any manner without the express 
 * written permission of CCXE(China) Co.,Ltd.
 *
 * Author: zhaoshujin
 * Date: 2012-4-6 下午02:58:32
 */
package com.regular;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @author zhaoshujin
 * 
 */
public class Regular {

	public boolean regularStr(String str, String pattern) {
		boolean flag = false;

		Pattern p = Pattern.compile(pattern);
		Matcher m = p.matcher(str);

		// flag = m.matches();
		flag = m.lookingAt();

		return flag;
	}

	public static void main(String[] args) {
		Regular rg = new Regular();

		String str = "600600..SH";
		String pattern = "^\\w{4,20}\\w{2,3}";

		System.out.println(rg.regularStr(str, pattern));
	}
}
